import { createApp } from 'vue'
import App from './App.vue'
import { createPinia } from 'pinia'
import Demo from './Demo.vue'


// 创建应用
const app = createApp(App)

app.component('Demo', Demo)
// 创建pinia
const pinia = createPinia()



// 安装插件
app.use(pinia)
app.config.globalProperties.x = 10000





// 定义全局声明， x 
declare module 'vue' {
    interface ComponentCustomProperties {

        x: number
    }
}



// 自定义指令

app.directive('beauty', (element, { value }) => {
    element.innerText += value
    element.style.color = 'green'
    element.style.backgroundColor = 'yellow'
})



// 挂载应用
app.mount('#app')



// 卸载应用
setTimeout(() => {
    app.unmount()
}, 3000);